﻿@model Transport.Areas.Administrator.Models.NewsItemModel
<script src="@Url.Content("~/Scripts/Views/Shared/tiny_mce/tiny_mce.js")" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(
    function () {
        tinyMCE.init({
            // General options
            mode: "textareas",
            theme: "advanced",
            plugins: "autolink,lists,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",

            // Theme options
            theme_advanced_buttons1: "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
            theme_advanced_buttons2: "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
            theme_advanced_buttons3: "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
            theme_advanced_buttons4: "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
            theme_advanced_toolbar_location: "top",
            theme_advanced_toolbar_align: "left",
            theme_advanced_statusbar_location: "bottom",
            theme_advanced_resizing: true,

            // Skin options
            skin: "o2k7",
            skin_variant: "silver",

            // Drop lists for link/image/media/template dialogs
            template_external_list_url: "js/template_list.js",
            external_link_list_url: "js/link_list.js",
            external_image_list_url: "js/image_list.js",
            media_external_list_url: "js/media_list.js",

            // Replace values for the template plugin
            template_replace_values: {
                username: "Some User",
                staffid: "991234"
            },
            editor_selector: "mceEditor",
            editor_deselector: "mceNoEditor"
        });
    }
);
</script>
@using (Html.BeginForm("Save", "News", FormMethod.Post))
{
    <div class="section-header">
        <div class="title">
            <img src="@Url.Content("~/Areas/Administrator/Content/images/ico-catalog.png")" alt="" />
            @(Model.NewsItemId > 0 ? "Sửa bài viết" : "Tạo mới bài viết")
        </div>
        <div class="options">
            <button type="submit" name="save" value="save" class="t-button">Lưu</button>
            <a href="@Url.Action("index")" class="t-button">Quay lại</a>
        </div>
    </div>
    
    @Html.HiddenFor(model => model.NewsItemId)
    <table width="100%">
        <tr>
            <td class="adminTitle">
                @Html.Label("Danh mục")
                <span class="field_required">*</span>
            </td>
            <td class="adminData">
                @Html.DropDownListFor(model => model.NewsCategoryItemId, new SelectList(Model.Categories, "NewsCategoryItemId", "CategoryName"), "-Chọn-")
                @Html.ValidationMessageFor(model => model.NewsCategoryItemId, "Danh mục là bắt buộc chọn.")
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.Label("Tiêu đề")
                <span class="field_required">*</span>
            </td>
            <td class="adminData">
                @Html.TextBoxFor(model => model.Title, new { style = "width:99%;" })
                @Html.ValidationMessageFor(model => model.Title)
            </td>
        </tr>
        <tr>
            <td valign="top" class="adminTitle">
                @Html.Label("Mô tả ngắn")
            </td>
            <td class="adminData">
                @Html.TextAreaFor(model => model.Short, new { @class = "mceNoEditor", @rows = 5, style = "width:99%;" })
                @Html.ValidationMessageFor(model => model.Short)
            </td>
        </tr>
        <tr>
            <td valign="top" class="adminTitle">
                @Html.Label("Nội dung")
            </td>
            <td>
                @Html.TextAreaFor(model => model.Full, new { @class = "mceEditor", style = "height:500px; width:100%;" })
            </td>
        </tr>
    </table>
    <br />
}


